<template>
  <div class="home middle clearfloat">
    <div class="home-info fl">
      <el-avatar :size="80" src="/_nuxt/assets/img/avatar.png"></el-avatar>
      <div class="info-welcome">
        <span>欢迎&emsp;</span><span>{{$store.state.user.name}}</span>
      </div>
      <div class="info-statistics">
        <p><span class="label">授权总数：</span><span>{{myInfo.authorization}}</span></p>
        <!-- <p><span class="label">实用新型案件数：</span><span>{{myInfo.practicals}}</span></p>
        <p><span class="label">外观设计案件数：</span><span>{{myInfo.appearances}}</span></p> -->
      </div>
      <div class="info-sumbit">
        <el-button @click="goApply">案件提交</el-button>
      </div>
    </div>
    <div class="agent-content fr">
      <nuxt-child></nuxt-child>
    </div>
  </div>
</template>

<script>
import { getMyInfo } from "~/api/company"
export default {
  
  data () {
    return {
      myInfo: {

      }
    }
  },
  computed: {
    agentGradClass () {
      if (this.$store.state.user.grade) {
        switch(this.$store.state.user.grade) {
          case 1:
            return 'info-level early';
          case 2:
            return 'info-level intermediate';
          case 3:
            return 'info-level senior';
        }
      } else {
        return ''
      }
    }
  },
  created () {
    let params = {
      company: this.$store.state.user.id,
      guard: 'company'
    }
    this.getMyinfo(params)
  },
  methods: {
    async getMyinfo (params) {
      let myInfo = await getMyInfo(this.$axios, params);
      if (myInfo.data.status == 'success') {
        // this.$store.commit("setRoleInfo",myInfo.data.data)
        this.$store.commit("setUser",myInfo.data.data)
        this.myInfo = myInfo.data.data
      }
    },
    goApply() {
      this.$router.push({
        path: '/user/apply'
      })
    }
  }
}
</script>

<style lang='less' scope>
  .home {
    margin-top: 19px;
    height: 660px;
    .home-info {
      width:320px;
      height: 100%;
      background:linear-gradient(0deg,rgba(85,173,255,1) 0%,rgba(182,215,255,1) 100%);
      position: relative;

      .el-avatar {
        margin: 74px auto 0;
        display: block;
      }
      .info-vip {
        height: 28px;
        width: 29px;
        margin: 10px auto;
        background:url('../../assets/img/图标.png') no-repeat;
        background-position:-94px -32px;
      }
      .info-statistics {
        margin-top: 20px;
        display: inline-block;
        position: absolute;
        left: 50%;
        transform: translate(-50%, 0);
        box-sizing: border-box;
        margin: 0 auto;
        font-size: 22px;
        line-height: 40px;
        color: #FEB103;
        vertical-align: middle;
        .label {
          color: #FFFFFF;
          font-size: 18px;
        }
      }
      .upgradeVIP {
        padding: 7px 24px 7px 23px;
        background: #0090ff;
        display: block;
        margin: 10px auto 0;
        border-radius: 0px;
      }
      .info-welcome {
        margin: 16px auto 20px;
        text-align: center;
        height:20px;
        font-size:18px;
        font-family:Source Han Sans CN;
        font-weight:400;
        color:rgba(27,27,27,1);
        line-height:24px;
      }
      .info-rate {
        width: 320px;
        margin: 40px auto 0;
        .rate-itme {
          margin-bottom: 16px;
        }
        .rate-itme:last-child {
          margin-bottom: 0px;
        }
        .rate-lable {
          font-size:15px;
          font-weight:300;
          color:rgba(255,255,255,1);
          font-family:Source Han Sans CN;

        }
        .el-rate {
          display: inline-block;
          margin-left: 22px;
          .el-rate__item {
            .el-rate__icon {
              margin-right: 14px;
              font-size:  24px;
              background: linear-gradient(0deg,#fddfaf 0%,#fcc752 100%);
              -webkit-background-clip: text;
              color: transparent !important;
            }
            .el-icon-star-on {
              background: linear-gradient(0deg,#fddfaf 0%,#fcc752 100%);
              -webkit-background-clip: text;
              color: transparent !important;
            }
            .el-rate__decimal {
              background: linear-gradient(0deg,#fddfaf 0%,#fcc752 100%);
              -webkit-background-clip: text;
              color: transparent !important;
            }
            .disabled {
              color: #b5c9cb !important;
            }
          }
          .el-rate__text {
            font-size:25px;
            color:rgba(254,177,3,1) !important;
            font-weight:800;
            font-family:Source Han Sans CN;
            margin-left: 5px;
            // font-style: oblique;
          }
          
          
        }
        
      }
      .info-level {
        width: 160px;
        height: 35px;
        margin: 235px auto 0;
        background:url('../../assets/img/图标.png') no-repeat;
      }
      .early {
        background-position:-67px -419px;
      }
      .intermediate {
        background-position:-279px -419px;
      }
      .senior {
        background-position:-496px -419px;
      }
      .info-sumbit {
        // text-align: center;
        position:absolute;
        bottom: 30px;
        left: 50%;
        transform: translate(-50%, 0);
      }
    }
    .agent-content {
      height: 100%;
      width: 770px;
    }
  }
</style>